﻿using System;
using System.IO;
using System.Windows.Forms;
using System.Windows.Markup;
using System.Windows.Media;

namespace MS.Common
{
    [MarkupExtensionReturnType(typeof(FontFamily))]
    public class FontFamilyExtension : MarkupExtension
    {
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var defaultFontFamily = "宋体"; //ConfigHelper.GetConfig("DefaultFontFamily", "宋体");
            return new FontFamily(defaultFontFamily);
        }
    }

    [MarkupExtensionReturnType(typeof(FontFamily))]
    public class IconFamilyExtension : MarkupExtension
    {
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var fontPath = Path.Combine(Application.StartupPath, "Fonts\\#iconfont");
            return new FontFamily(fontPath);
        }
    }
}
